![]() |
![]() ![]() |
![]() |
![]()
Post
#1
|
|
Grupa: Zarejestrowani Postów: 8 Pomógł: 0 Dołączył: 27.09.2007 Ostrzeżenie: (0%) ![]() ![]() |
Witam,
mam problem z prasowaniem pliku xml. Ładuję plik xml za pomocą simplexml_load_file(). W pliku xml znajduje się fragment:
odpalając skrypt wywala mi error: Warning: simplexml_load_file() [function.simplexml-load-file]: ./dane.xml:10: parser error : StartTag: invalid element name in /www/skrypt.php on line 15 Warning: simplexml_load_file() [function.simplexml-load-file]: <1></1> in /www/skrypt.php on line 15 Warning: simplexml_load_file() [function.simplexml-load-file]: ^ in /www/skrypt.php on line 15 Warning: simplexml_load_file() [function.simplexml-load-file]: ./dane.xml:10: parser error : expected '>' in /www/skrypt.php on line 15 Warning: simplexml_load_file() [function.simplexml-load-file]: <1></1> in /www/skrypt.php on line 15 Warning: simplexml_load_file() [function.simplexml-load-file]: ^ in /www/skrypt.php on line 15 skrypt.php on line 15 - to funkcja simplexml_load_file() Kiedy natomiast z pliku xml wywalę ten fragment to skrypt działa poprawnie. Rozumiem, że chodzi tutaj o tagi <1></1> itd. bo jak zamieniłem na na <z1></z1> itd. to również chodziło dobrze. Jak mogę rozwiązać ten problem, żeby odczytywał tagi <1></1> a nie wywalał error. |
|
|
![]()
Post
#2
|
|
Grupa: Moderatorzy Postów: 8 989 Pomógł: 1550 Dołączył: 8.08.2008 Skąd: Słupsk/Gdańsk ![]() |
http://www.w3schools.com/XML/xml_elements.asp
Kod XML Naming Rules XML elements must follow these naming rules: Names can contain letters, numbers, and other characters --- Names cannot start with a number or punctuation character --- Names cannot start with the letters xml (or XML, or Xml, etc) Names cannot contain spaces Ludzi... wiele lat istnienia xml-a, tak prostej struktury a oni nadal nie wiedzą jak powinien wyglądać. A skoro to jest parser xml-a... (a nie stwora xml-owego) więc nie za bardzo zmusisz go do współpracy. |
|
|
![]()
Post
#3
|
|
Grupa: Zarejestrowani Postów: 8 Pomógł: 0 Dołączył: 27.09.2007 Ostrzeżenie: (0%) ![]() ![]() |
Gdyby ktoś znał lepsze rozwiązanie niż moje poniższe, to chętnie wysłucham (IMG:style_emoticons/default/smile.gif)
|
|
|
![]() ![]() |
![]() |
Aktualny czas: 27.08.2025 - 09:52 |